﻿using UnityEngine;

namespace HKTools
{
    public class HK_DialogTargetFollow : MonoBehaviour
    {
        [Header("是否跟踪："), SerializeField] bool isFollow;
        [Header("跟踪目标："), SerializeField] Transform followTarget;

        Vector3 posOffset;

        void Start()
        {
            posOffset = transform.position - followTarget.position;
        }

        void Update()
        {
            if (!isFollow) return;

            transform.position = followTarget.position + posOffset;
        }
    }
}